/*
 * @Author: 王锴 1148506760@qq.com
 * @Date: 2024-01-15 19:54:33
 * @LastEditors: 王锴 1148506760@qq.com
 * @LastEditTime: 2024-01-16 14:24:01
 * @Description: 
 */
import ReactECharts from "echarts-for-react"
import * as echarts from "echarts"
//定义组件可传参数
const EchartsDom = (props) => {
  const option = {
    grid: {
      show: false,
      left: "2%",
      top: "2%",
      right: "8%",
      bottom: "0%",
      borderWidth: 1,
    },
    tooltip: {
      trigger: 'item'
    },
    legend: {
      orient: 'vertical',
      x: 'left',
      top: 10,
      // right: 10,
      textStyle: {
        color: 'rgb(255,255,255,0.9)',
      }
    },
    series: [
      {
        type: 'pie',
        radius: ['40%', '70%'],
        avoidLabelOverlap: true,
        itemStyle: {
          borderRadius: 2,
          borderColor: '#fff',
          borderWidth: 2,
        },
        label: {
          show: false,
          position: 'center',
          formatter: '{b}:{d}%'
        },
        emphasis: {
          label: {
            show: true,
            fontSize: '30',
            fontWeight: 'bold'
          }
        },
        labelLine: {
          show: false
        },
        data: props.chartsPie
      }
    ]
  };
  return (
    <ReactECharts option={option} style={{ width: `${props?.wight}`, height: `${props?.height}` }} ></ReactECharts>
  )
}
export default EchartsDom;